﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    class testReturnFinally
    {
        public static void Start()
        {
            Console.WriteLine(Test1());
            Console.WriteLine(Test2().Num);
        }

        public static Int32 Test1()
        {
            Int32 i = 10;
            try
            {
                return i;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                i = 11;
            }
        }

        public static TestObj Test2()
        {
            TestObj o = new TestObj { Num = 100 };
            try
            {
                return o;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                o.Num = 101;
            }
        }

        public class TestObj
        {
            public Int32 Num = 1;
        }
    }
}
